def print_subdirectories(directory)
    Dir.foreach(directory) do |item|
      next if item == '.' || item == '..'
  
      path = File.join(directory, item)
      if File.directory?(path)
        puts item  # 输出子文件夹名称
        print_subdirectories(path)  # 递归遍历子文件夹
      end
    end
  end
  
  # 指定目录路径
  directory_path = './demo'
  
  # 调用函数输出子文件夹名称
  print_subdirectories(directory_path)
  